exports.install = function (Vue, options) {
    var self = Vue.prototype;

    /**
     * 消息提示框
     * @param judge 是否显示close，默认为true
     * @param msg 提示内容
     * @param type 提示框类型 success info warning error
     * @return elemnt-ui message方法
     */
    self.message = function (judge, msg, type) {
        return this.$message({
            showClose: judge,
            message: msg,
            type: type
        });
    };

    /**
     * 将时间戳 转换为 X天X小时X分钟
     * @param mss 将要转化的时间戳
     */
    formatDuring = function (mss) {
        var days = parseInt(mss / (60 * 60 * 24));
        var hours = parseInt((mss % (60 * 60 * 24)) / (60 * 60));
        var minutes = parseInt((mss % (60 * 60)) / 60);
        var seconds = mss % 60;
        return days + " 天 " + hours + " 小时 " + minutes + " 分钟 ";
    };

    /**
     * 对话框
     * @param callBack 确定执行的回调函数
     * @param catchBack 取消执行的回调函数
     * @param msg 对话框的内容
     * @param type 对话框类型
     * @param data 对话框按钮和种类属性等对象
     */
    confirm = function (callBack, catchBack, msg, type, data) {
        msg = typeof msg !== 'undefined' ? msg : '是否取消操作？';
        type = typeof type !== 'undefined' ? type : '提示';
        data = typeof data !== 'undefined' ? data : {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
        };
        typeof callBack !== 'function'
            ? this.$confirm(msg, type, data)
            : (typeof catchBack !== 'function'
            ? this.$confirm(msg, type, data).then(callBack)
            : this.$confirm(msg, type, data).then(callBack).catch(catchBack));
    };

    /**
     * 登录成功后本地保存用户的状态
     */
    saveUserState = function(userName, userPhone) {
        userName = typeof userName == 'undefined' ? 'user' : userName;
        userPhone = typeof userPhone == 'undefined' ? '0' : userPhone;
        var d = new Date();
        d.setTime(d.getTime() + (24 * 60 * 60 * 1000));
        var expires = "expires=" + d.toUTCString();
        document.cookie = userName + "=" + userPhone + "; " + expires;
    };

    /**
     * 获得本地用户登录状态
     * @param {String} userName 
     */
    getUserState = function(userName) {
        typeof userName == 'undefined' ? 'user' : userName;
        var arr, reg = new RegExp("(^| )" + userName + "=([^;]*)(;|$)");
        if (arr = document.cookie.match(reg)) {
            return arr[2] == '0' ? null : arr[2];
        }
        else
            return null;
    };

    //全局函数2，无参
    self.text2 = function () {
        alert('执行成功2');
    };

 };